Plots QSM cylinders and point clouds using the rgl library
Usage
plot_qsm(
cylinder,
radius = NULL,
color = NULL,
palette = NULL,
facets = 6,
cloud = NULL,
pt_color = NULL,
pt_size = NULL,
axes = TRUE,
hover = FALSE,
skeleton = FALSE,
bg_color = NULL
)Arguments
- cylinder
QSM cylinder data frame
- radius
Column name of radii as a quoted string. Defaults to the modified radii.
- color
Optional cylinder color parameter. Colors must be a single hex color, a vector of hex colors, or a quoted column name. It can also be set to "random" to generate a random solid color. Vectors must have the same length as the cylinder data frame.
- palette
Optional color palette for numerical data. Palettes include: viridis, inferno, plasma, magma, cividis, and rainbow.
- facets
The number of facets in the polygon cross section. Defaults to 6, but can be increased to improve visual smoothness at the cost of performance and memory.
- cloud
Point cloud data frame where the first three columns are the x, y, and z coordinates in the same coordinate system as the QSM. Defaults to NULL.
- pt_color
Color of the point cloud. Defaults to black. Can be set to "random".
- pt_size
Size of the points. Defaults to 0.1.
- axes
Show plot axes. Defaults to TRUE.
- hover
Show cylinder and branch id on mouse hover. Defaults to FALSE.
- skeleton
Plot the QSM skeleton instead of cylinders. Defaults to FALSE.
- bg_color
Set the background color of the rgl plot. Defaults to NULL.
Examples
## TreeQSM Processing Chain
file <- system.file("extdata/QSM.mat", package = "rTwig")
qsm <- import_qsm(file)
#> Importing TreeQSM .mat
cylinder <- qsm$cylinder
cylinder <- update_cylinders(cylinder)
#> Updating Cylinder Ordering
#> Calculating Total Children
#> Building Cylinder Network
#> Calculating Growth Length
#> Calculating Reverse Branch Order
#> Calculating Branch Segments
#> Calculating Distance From Base
#> Calculating Average Distance To Twigs
plot_qsm(cylinder)
#> Plotting QSM
#> Plotting Cylinders
## SimpleForest Processing Chain
file <- system.file("extdata/QSM.csv", package = "rTwig")
cylinder2 <- read.csv(file)
cylinder2 <- update_cylinders(cylinder2)
#> Updating Branch Ordering
#> Calculating Total Children
#> Building Cylinder Network
#> Calculating Distance From Base
#> Calculating Average Distance To Twigs
plot_qsm(cylinder2)
#> Plotting QSM
#> Plotting Cylinders
## All Parameters
file2 <- system.file("extdata/cloud.txt", package = "rTwig")
cloud <- read.table(file2, header = FALSE)
plot_qsm(
cylinder,
radius = "UnmodRadius",
color = "growthLength",
palette = "viridis",
facets = 100,
cloud = cloud,
pt_color = "random",
pt_size = 1,
axes = FALSE,
hover = TRUE,
bg_color = "black"
)
#> Plotting QSM
#> Plotting Cylinders
#> Plotting Cloud
3D plot